<?php

namespace App;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;

/**
 * App\CourseCollection
 *
 * @method static bool|null forceDelete()
 * @method static \Illuminate\Database\Eloquent\Builder|\App\CourseCollection newModelQuery()
 * @method static \Illuminate\Database\Eloquent\Builder|\App\CourseCollection newQuery()
 * @method static \Illuminate\Database\Query\Builder|\App\CourseCollection onlyTrashed()
 * @method static \Illuminate\Database\Eloquent\Builder|\App\CourseCollection query()
 * @method static bool|null restore()
 * @method static \Illuminate\Database\Query\Builder|\App\CourseCollection withTrashed()
 * @method static \Illuminate\Database\Query\Builder|\App\CourseCollection withoutTrashed()
 * @mixin \Eloquent
 * @property int $id
 * @property int $course_id 课程id
 * @property int $user_id 收藏的用户
 * @property \Illuminate\Support\Carbon|null $deleted_at
 * @property \Illuminate\Support\Carbon|null $created_at
 * @property \Illuminate\Support\Carbon|null $updated_at
 * @method static \Illuminate\Database\Eloquent\Builder|\App\CourseCollection whereCourseId($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\CourseCollection whereCreatedAt($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\CourseCollection whereDeletedAt($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\CourseCollection whereId($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\CourseCollection whereUpdatedAt($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\CourseCollection whereUserId($value)
 */
class CourseCollection extends Model
{
    protected $table = "course_collection";
    use SoftDeletes;

    public static function getCourseCollectionStatus($courseId = 0,$userId = 0){
        $isCollection = CourseCollection::whereCourseId($courseId)->whereUserId($userId)->first();
        if($isCollection){
            return 1;
        }else{
            return 0;
        }
    }
}
